import java.awt.Graphics;
import java.awt.Image;
import java.awt.Point;
import java.awt.Rectangle;
import java.util.ArrayList;
import java.util.Timer;

import javax.swing.JPanel;

public class Repair extends JPanel {

	public Image image;
	public int x, y;

	ArrayList<Point> points4 = new ArrayList<Point>(100);

	Rectangle rect;

	public boolean active;

	public Repair(Image image) {
		this.image = image;
		x = 800;
		y = (int) (Math.random() * (320 - image.getHeight(null)));

		rect = new Rectangle(image.getWidth(null), image.getHeight(null));

	}

	public void render(Graphics g) {

		if (active) {
			g.drawImage(image, x, y, null);
		}

	}

	public void update() {
		x = x - 5;

		if (x < 0 - image.getWidth(null)) {
			active = false;
		}

	}

	public Rectangle getArea() {
		rect.x = x;
		rect.y = y;
		return rect;
	}

}
